package ${packageName}.mvp.ui.base;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import ${packageName}.event.BusEvent;
import ${packageName}.event.BusProvider;
import com.jpxx.base.ui.mvp.IPresenter;
import com.jpxx.base.ui.mvp.base.IBaseFragment;

import org.greenrobot.eventbus.Subscribe;

public abstract class BaseFragment<P extends IPresenter> extends IBaseFragment<P> {
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        if(!BusProvider.getInstance().isRegistered(this)){
            BusProvider.getInstance().register(this);
        }
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    @Override
    public void onDestroyView() {
        BusProvider.getInstance().unregister(this);
        super.onDestroyView();
    }

    @Subscribe
    public void onEmptyEvent(BusEvent emptyEvent){

    }
}
